import Vue from 'vue'
import App from './App.vue'
import {
  initRouter
} from './router'
import './theme/index.less'
import Antd from 'ant-design-vue'
import Viser from 'viser-vue'
// import '@/mock'

import Astrict from './utils/astrict.js'
import 'vue-bmap-gl/dist/style.css'
import store from './store'
import 'animate.css/source/animate.css'
import Plugins from '@/plugins'
import './assets/iconfont.css'
// import echarts from 'echarts'
import {
  initI18n
} from '@/utils/i18n'
import bootstrap from '@/bootstrap'
import 'moment/locale/zh-cn'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import swiperCss from 'swiper/swiper-bundle.css'
import * as echarts from 'echarts'
import VueClipboard from 'vue-clipboard2'
// import * as math from 'mathjs' // 1.6.4 math.js

// import VueCropper from 'vue-cropper'
const router = initRouter(store.state.setting.asyncRoutes)
const i18n = initI18n('CN', 'US')
// Vue.use(VueCropper)
Vue.use(Antd)
Vue.use(Astrict)
Vue.prototype.$echarts = echarts
// Vue.prototype.$math = math // 1.6.4 math.js
if (process.env.NODE_ENV === 'production') {
  Vue.config.productionTip = false
}
Vue.use(VueAwesomeSwiper, {
  swiperCss
} /* { default options with global component } */)

Vue.use(Viser)
Vue.use(Plugins)

Vue.use(VueClipboard)
const e = Vue.prototype.$message

e.config({
  top: '80px'
})
e.newFun = (a, b, c) => {
  switch (b) {
    case 'success':
      e.success({
        content: a,
        duration: c,
        icon: (h) => < img src = {
          require('@/assets/img/icon_success.png')
        }
        />
      })
      break
    case 'error':
      e.error({
        content: a,
        duration: c,
        icon: (h) => < img src = {
          require('@/assets/img/icon_error.png')
        }
        />
      })
      break
    case 'warning':
      e.warning({
        content: a,
        duration: c,
        icon: (h) => < img src = {
          require('@/assets/img/icon_warning.png')
        }
        />
      })
      break
    default:
      break
  }
}

bootstrap({
  router,
  store,
  i18n,
  message: e
})

new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')
